#pragma once
#include<iostream>
class string
{
public:
	string(const char* str = "")
	{
		_size = strlen(str);
		_capacity = _size;
		_str = new char[_capacity + 1];
		strcpy(_str, str);
	}

	string(const string& s)
	{
		_str = new char[s._capacity + 1];
		strcpy(_str, s._str);
		_size = s._size;
		_capacity = s._capacity;
	}

	string& operator=(const string& s)
	{
		if (&s != this)
		{
			delete[] _str;
			_str = new char[s._capacity + 1];
			strcpy(_str, s._str);
			_size = s._size;
			_capacity = s._capacity;
			return *this;
		}
		return *this;
	}

	~string()
	{
		delete[] _str;
		_str = nullptr;
		_capacity = _size = 0;
	}

private:
	char* _str;
	size_t _capacity;
	size_t _size;
};